package com.example.designpatterns.behavioral.state;

/**
 * 订单类
 *
 * @author scott
 */
public class Order {

    private OrderState currentState;

    public Order() {
        // 初始状态为待支付
        currentState = new PendingPaymentState();
    }

    public void setState(OrderState state) {
        currentState = state;
    }

    public void cancelOrder() {
        currentState.cancelOrder();
    }

    public void verifyPayment() {
        currentState.verifyPayment();
    }

    public void completeOrder() {
        currentState.completeOrder();
    }

}
